{
 "cells": [
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "pi = 3.14159\n",
    "r = eval(input('输入圆的半径'))\n",
    "d = 2 * pi * r\n",
    "s = pi * r * r\n",
    "print('d={:.2f}'.format(d))\n",
    "print('s={:.2f}'.format(s))"
   ],
   "metadata": {
    "collapsed": true,
    "is_executing": true
   },
   "id": "initial_id",
   "execution_count": 0
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "a, b = eval(input('输入两个数：'))\n",
    "if a >= b:\n",
    "    print('a大于等于b')\n",
    "else:\n",
    "    print('a小于b')"
   ],
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "id": "bf14df6850430137"
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "x = eval(input('输入一个整数：'))\n",
    "if (x % 2 == 0) and (0 < x < 100):\n",
    "    print('输入的是小于100的偶数')\n",
    "else:\n",
    "    print('输入的是其他数')"
   ],
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "id": "cd5743cb417dbf25"
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "#4.2选择结构编程练习第2题\n",
    "from random import randint\n",
    "\n",
    "lst = [randint(40, 100)for_in range(10)]\n",
    "avg = sum(lst) / len(lst)\n",
    "if avg >= 90:\n",
    "    s = '优秀'\n",
    "elif avg >= 75:\n",
    "    s = '良好'\n",
    "elif avg >= 60:\n",
    "    s = '中等'\n",
    "else:\n",
    "    s = '不合格'\n",
    "print('平均分:{:.1f},{}'.format(avg, s))"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "c275f27dbbd5f5a2"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
